package com.final_project.zombiemenace.screens;

import com.final_project.zombiemenace.model.Assets;
import com.kilobolt.framework.Game;
import com.kilobolt.framework.Graphics;
import com.kilobolt.framework.Graphics.ImageFormat;
import com.kilobolt.framework.Screen;

public class LoadingScreen extends Screen {

	public LoadingScreen(Game game) {
		super(game);
	}

	@Override
	public void update(float deltaTime) {

		loadImages();
		loadSoundAndMusic();
		game.setScreen(new GameScreenZombie(game));

	}

	private void loadSoundAndMusic() {
		Assets.shoot = game.getAudio().createMusic(
				"sterling_burst_shooting.ogg");
		Assets.characterDies = game.getAudio().createSound(
				"character_death.ogg");
		Assets.greenZombieEntrance = game.getAudio().createSound(
				"green_zombie_entrance.ogg");
		Assets.purpleZombieEntrance = game.getAudio().createSound(
				"purple_zombie_entrance.ogg");
		Assets.zombieInPain = game.getAudio().createSound("zombie_in_pain.ogg");
		Assets.zombieAttack = game.getAudio().createSound(
				"zombie_attack.ogg");
		Assets.gameplayMusics = game.getAudio().createMusic(
				"gameplay_music.ogg");
	}

	private void loadImages() {
		Graphics g = game.getGraphics();
		Assets.joystickBackground = g.newImage("joystick_bg.png",
				ImageFormat.ARGB4444);
		Assets.joystick = g.newImage("joystick.png", ImageFormat.ARGB4444);
		Assets.background = g.newImage("background.png", ImageFormat.RGB565);
		Assets.character = g.newImage("player.png", ImageFormat.ARGB4444);
		Assets.bullet = g.newImage("bullet.png", ImageFormat.ARGB4444);
		Assets.greenZombie1 = g.newImage("zombie0.png", ImageFormat.ARGB4444);
		Assets.greenZombie2 = g.newImage("zombie1.png", ImageFormat.ARGB4444);
		Assets.greenZombie3 = g.newImage("zombie2.png", ImageFormat.ARGB4444);
		Assets.greenZombie4 = g.newImage("zombie3.png", ImageFormat.ARGB4444);
		Assets.purpleZombie1 = g.newImage("purple_zombie0.png",
				ImageFormat.ARGB4444);
		Assets.purpleZombie2 = g.newImage("purple_zombie1.png",
				ImageFormat.ARGB4444);
		Assets.purpleZombie3 = g.newImage("purple_zombie2.png",
				ImageFormat.ARGB4444);
		Assets.purpleZombie4 = g.newImage("purple_zombie3.png",
				ImageFormat.ARGB4444);
		Assets.bloodStain = g.newImage("blood_stain.png", ImageFormat.ARGB4444);
		Assets.pauseButton =g.newImage("pause_button.png", ImageFormat.ARGB4444);
	}

	@Override
	public void paint(float deltaTime) {
		// should be empty we dont paint anything
		// if we have a previous screen like splash screen where we
		// load an image we should draw the image here
		// Graphics g = game.getGraphics();
		// g.drawImage(Assets.splash, 0, 0);

	}

	@Override
	public void pause() {
		// should be empty we cant pause the loading

	}

	@Override
	public void resume() {
		// should be empty we cant resume the loading
	}

	@Override
	public void dispose() {
		// should be empty we cant dispose the loading

	}

	@Override
	public void backButton() {
		// should be empty we cant go back while the loading screen is on
	}

}
